package com.xinzhi.controller;

import com.baomidou.mybatisplus.extension.api.R;
import com.tencentcloudapi.hcm.v20181106.models.EvaluationRequest;
import com.xinzhi.pojo.Payee;
import com.xinzhi.service.PayeeService;
import com.xinzhi.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class PayeeController {
    @Autowired
    private PayeeService payeeService;

    /**
     * 查询所有收款人
     * @param user_id
     * @return
     */
    @RequestMapping("/getAll")
    public Result getAll(Integer user_id){
        return payeeService.getAll(user_id);
    }

    /**
     * 根据银行卡号和id添加收款人
     * @param card_number
     * @param id
     * @return
     */
    @GetMapping("/insertPayee")
    public Result insert(@RequestParam("card_number") String card_number,@RequestParam("id") Integer id){
        return payeeService.insertPayee(card_number,id);
}

    /**
     * 根据user_id和银行卡号查询用户信息
     * @param user_id
     * @return
     */
    @GetMapping("/selectPayee")
    public Result select(@RequestParam("user_id") Integer user_id){
        Result payeess = payeeService.selectPayee(user_id);
        return payeess;
}
}
